]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
TelepathyClient: remove call and file transfer approval
authorGiovanni Campagna <scampa.giovanni@gmail.com>
Tue, 3 Mar 2015 08:18:42 +0000 (00:18 -0800)
committerGiovanni Campagna <scampa.giovanni@gmail.com>
Tue, 3 Mar 2015 22:20:48 +0000 (14:20 -0800)
Let empathy deal with these.

https://bugzilla.gnome.org/show_bug.cgi?id=745503

js/ui/components/telepathyClient.js
src/shell-tp-client.c

index fa0d621c91c97a94ce8109991db3cbe1cbc46ce8..b6baa63570bacb8a5f674c6924bfc68d6a983d15 100644 (file)
@@ -248,10 +248,6 @@ const TelepathyClient = new Lang.Class({
 
         if (chanType == Tp.IFACE_CHANNEL_TYPE_TEXT)
             this._approveTextChannel(account, conn, channel, dispatchOp, context);
-        else if (chanType == Tp.IFACE_CHANNEL_TYPE_CALL)
-            this._approveCall(account, conn, channel, dispatchOp, context);
-        else if (chanType == Tp.IFACE_CHANNEL_TYPE_FILE_TRANSFER)
-            this._approveFileTransfer(account, conn, channel, dispatchOp, context);
         else
             context.fail(new Tp.Error({ code: Tp.Error.INVALID_ARGUMENT,
                                         message: 'Unsupported channel type' }));
@@ -277,40 +273,6 @@ const TelepathyClient = new Lang.Class({
         }
     },
 
-    _approveCall: function(account, conn, channel, dispatchOp, context) {
-        let isVideo = false;
-
-        let props = channel.borrow_immutable_properties();
-
-        if (props[Tp.PROP_CHANNEL_TYPE_CALL_INITIAL_VIDEO])
-          isVideo = true;
-
-        // We got the TpContact
-        let source = new ApproverSource(dispatchOp, _("Call"), isVideo ?
-                                        Gio.icon_new_for_string('camera-web') :
-                                        Gio.icon_new_for_string('audio-input-microphone'));
-        Main.messageTray.add(source);
-
-        let notif = new AudioVideoNotification(source, dispatchOp, channel,
-            channel.get_target_contact(), isVideo);
-        source.notify(notif);
-        context.accept();
-    },
-
-    _approveFileTransfer: function(account, conn, channel, dispatchOp, context) {
-        // Use the icon of the file being transferred
-        let gicon = Gio.content_type_get_icon(channel.get_mime_type());
-
-        // We got the TpContact
-        let source = new ApproverSource(dispatchOp, _("File Transfer"), gicon);
-        Main.messageTray.add(source);
-
-        let notif = new FileTransferNotification(source, dispatchOp, channel,
-            channel.get_target_contact());
-        source.notify(notif);
-        context.accept();
-    },
-
     _delegatedChannelsCb: function(client, channels) {
         // Nothing to do as we don't make a distinction between observed and
         // handled channels.
@@ -1043,71 +1005,4 @@ const RoomInviteNotification = new Lang.Class({
     }
 });
 
-// Audio Video
-const AudioVideoNotification = new Lang.Class({
-    Name: 'AudioVideoNotification',
-    Extends: MessageTray.Notification,
-
-    _init: function(source, dispatchOp, channel, contact, isVideo) {
-        let title = '';
-
-        if (isVideo)
-             /* translators: argument is a contact name like Alice for example. */
-            title = _("Video call from %s").format(contact.get_alias());
-        else
-             /* translators: argument is a contact name like Alice for example. */
-            title = _("Call from %s").format(contact.get_alias());
-
-        this.parent(source, title);
-        this.setResident(true);
-
-        this.setUrgency(MessageTray.Urgency.CRITICAL);
-
-        this.addAction(_("Decline"), Lang.bind(this, function() {
-            dispatchOp.leave_channels_async(Tp.ChannelGroupChangeReason.NONE, '', function(src, result) {
-                src.leave_channels_finish(result);
-            });
-            this.destroy();
-        }));
-        /* translators: this is a button label (verb), not a noun */
-        this.addAction(_("Answer"), Lang.bind(this, function() {
-            dispatchOp.handle_with_time_async('', global.get_current_time(), function(src, result) {
-                src.handle_with_time_finish(result);
-            });
-            this.destroy();
-        }));
-    }
-});
-
-// File Transfer
-const FileTransferNotification = new Lang.Class({
-    Name: 'FileTransferNotification',
-    Extends: MessageTray.Notification,
-
-    _init: function(source, dispatchOp, channel, contact) {
-        this.parent(source,
-                    /* To translators: The first parameter is
-                     * the contact's alias and the second one is the
-                     * file name. The string will be something
-                     * like: "Alice is sending you test.ogg"
-                     */
-                    _("%s is sending you %s").format(contact.get_alias(),
-                                                     channel.get_filename()));
-        this.setResident(true);
-
-        this.addAction(_("Decline"), Lang.bind(this, function() {
-            dispatchOp.leave_channels_async(Tp.ChannelGroupChangeReason.NONE, '', function(src, result) {
-                src.leave_channels_finish(result);
-            });
-            this.destroy();
-        }));
-        this.addAction(_("Accept"), Lang.bind(this, function() {
-            dispatchOp.handle_with_time_async('', global.get_current_time(), function(src, result) {
-                src.handle_with_time_finish(result);
-            });
-            this.destroy();
-        }));
-    }
-});
-
 const Component = TelepathyClient;
index 817700e57d96a10e223a2dd70558a4862f954f9a..5ea3e76a20acd807d10c4d0974ac1f7a27d738b1 100644 (file)
@@ -112,21 +112,6 @@ shell_tp_client_init (ShellTpClient *self)
         TP_HANDLE_TYPE_ROOM,
       NULL));
 
-  /* Approve calls. We let Empathy handle the call itself. */
-  tp_base_client_take_approver_filter (TP_BASE_CLIENT (self),
-      tp_asv_new (
-        TP_PROP_CHANNEL_CHANNEL_TYPE, G_TYPE_STRING, TP_IFACE_CHANNEL_TYPE_CALL,
-        TP_PROP_CHANNEL_TARGET_HANDLE_TYPE, G_TYPE_UINT, TP_HANDLE_TYPE_CONTACT,
-        NULL));
-
-  /* Approve file transfers. We let Empathy handle the transfer itself. */
-  tp_base_client_take_approver_filter (TP_BASE_CLIENT (self),
-      tp_asv_new (
-        TP_PROP_CHANNEL_CHANNEL_TYPE, G_TYPE_STRING,
-          TP_IFACE_CHANNEL_TYPE_FILE_TRANSFER,
-        TP_PROP_CHANNEL_TARGET_HANDLE_TYPE, G_TYPE_UINT, TP_HANDLE_TYPE_CONTACT,
-        NULL));
-
   /* Handler */
   tp_base_client_add_handler_filter (TP_BASE_CLIENT (self), filter);